package com.xs.web;

import com.xs.pojo.Log;
import com.xs.service.LogSercice;
import com.xs.service.impl.LogSerciceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/deleteServlet")
public class DeleteServlet extends HttpServlet {
    LogSercice logSercice=new LogSerciceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收数据
        Integer id = Integer.parseInt(request.getParameter("id"));
        logSercice.Delete(id);

        System.out.println("ID为=="+id+"==的数据已删除");

        response.sendRedirect(request.getContextPath()+"/selectServlet");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
